const http = require('http')
const server = http.createServer((req,res)=>{
    console.log(req.method)
    const {pathname,query} = require('url').parse(req.url,true)
    console.log(pathname,query)
    console.log(req.httpVersion)

    console.log(req.headers)

    // body 数据
    const buffer = []
    req.on('data',(chunk)=>{
        buffer.push(chunk)
    })
    req.on('end',()=>{
        console.log(Buffer.concat(buffer).toString())
    })
    res.statusCode = 200
    res.setHeader('content-type','text/html;charset=utf8')
    res.end('哈哈哈')
})
server.listen(3000)
